Skip to content

fix(android): keep a timed-out target probe from failing discovery of other devices - #4883

Merged
thymikee merged 2 commits into
mainfrom
t3/android-probe-open-timeout
Nov 21, 2026
Merged

thymikee merged 2 commits into
mainfrom
t3/android-probe-open-timeout

Conversation

@thymikee

@thymikee thymikee commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Android discovery probes every listed emulator's target (getprop, has-feature, pm list features). A timeout on one busy emulator rejected the whole discovery, so it failed an open for a different device.

A device whose target probe times out (typed adbFailure: 'timeout') now stays listed with an unknown target. Unknown reads as mobile in selection. Discovery emits one warn diagnostic, android_inventory_target_probe_failed, with the serial. The requested --serial, other failures, and request aborts still fail discovery, so a selected device never runs with a demoted target.

Two files changed: packages/platform-android/src/inventory.ts and its test. No new flags or modes.

Fixes #4765

Before / after

  • Before: a fake adb that times out pm list features for emulator-5554 makes discovery reject, so emulator-5556 is unreachable.
  • After: both devices are listed, emulator-5556 has target mobile, and a diagnostic names the slow device.

Validation

  • pnpm vitest run packages/platform-android/src/inventory.test.ts: the new regression test fails on base c37bb95630 source (rejects with adb timed out after 10000ms). It passes at head 7a4ff0289d (19/19).
  • Further tests check that an aborted request and a timed-out requested serial still reject.
  • pnpm typecheck and pnpm format pass locally.
  • CI owns full validation. No device run: the change is inventory logic covered by a fake adb.
  • Unverified: live behavior on a loaded emulator host.

🤖 Generated with Claude Code


Proof this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.48 MB 6.48 MB +329 B
Package (unpacked) 6.48 MB 6.48 MB +329 B
Package (download) 1.97 MB 1.97 MB +91 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 31.1 ms 18.9 ms -12.3 ms
CLI --help 53.8 ms 44.2 ms -9.6 ms

… other devices

Fixes #4765

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@thymikee
thymikee force-pushed the t3/android-probe-open-timeout branch from 1f22445 to 4e1dd89 Compare November 21, 2026 09:46
@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at 4e1dd89: a timed-out target probe now degrades instead of failing discovery of the other devices. The review was read-only, so the new tests were not run. Not verified here: that the regression test fails on base c37bb95, which was checked by reading the code path, and live behavior on a loaded emulator host. No conflicts. The Body rules check shows as cancelled, not failed, and the diff touches no body or gate path, so re-running it should pass. One other check is still queued. Not blocking, and fine to take or leave: an Android TV or Fire TV device whose probe times out gets an undefined target, which selection reads as mobile (https://github.com/callstack/agent-device/blob/4e1dd89/packages/platform-android/src/inventory.ts#L236), so a follow-up could keep unknown-target devices out of default single-device auto-selection or show them in devices output and the no-match hint. The slow device is still probed and discovery still waits up to the 10s probe timeout (https://github.com/callstack/agent-device/blob/4e1dd89/packages/platform-android/src/inventory.ts#L227), so a follow-up could probe lazily or cap the probe below the open budget. The abort test only asserts AppError without a code, so it could assert the code or throw the error the host runner throws on abort (https://github.com/callstack/agent-device/blob/4e1dd89/packages/platform-android/src/inventory.test.ts#L259).

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 21, 2026
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 4e1dd89

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/platform-android/src/inventory.ts:226 TV probe timeout demotes the device to mobile: --target tv misses it, wrong launcher category

Reviewed with this repository's own Sentinel configuration (c37bb956307c).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 4e1dd89. The verdict and the full list are in the summary comment.

… times out

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Thanks. Pushed 7a4ff02: a timed-out target probe now fails discovery when it is the requested --serial (test added), so a selected device never runs with a demoted target. Only unselected devices degrade. That narrows the identity-flip and launch-category concern raised in the review. The abort test now asserts the COMMAND_FAILED code. Lazy or capped probing, and keeping unknown-target devices out of single-device auto-selection, stay as follow-ups.

@thymikee
thymikee merged commit e52b306 into main Nov 21, 2026
19 of 21 checks passed
@thymikee
thymikee deleted the t3/android-probe-open-timeout branch November 21, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android discovery feature probe on other emulators can time out an unrelated open

1 participant